package com.anji.plus.gaea.inf.exception;

import lombok.Data;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;

@Data
@RequiredArgsConstructor(staticName = "code")
public class InfException extends RuntimeException{


    @NonNull
    private String code;
    private String message;

    private Object[] args;

    public InfException message(String message)  {
        this.message = message;
        return this;
    }

    public Object[] getArgs() {
        if(args != null) {
            return args.clone();
        }else {
            return null;
        }

    }

    public InfException args(Object[] args) {
        if(args != null) {
            this.args = args.clone();
        }
        return this;
    }
}
